package com.xuecheng.ucenter.FeignClient;

import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * 远程调用验证码校验的降级处理类
 * @author 冯佳鑫 又菜又爱学
 * @version 1.0
 * @DATE now()
 */
@Slf4j
@Component
public class CheckCodeServiceClientFallbackFactory implements FallbackFactory<CheckCodeClient> {

    @Override
    public CheckCodeClient create(Throwable throwable) {
        return new CheckCodeClient() {

            @Override
            public Boolean verify(String key, String code) {
                log.debug("认证管理远程调用验证码服务发生熔断并进行降级处理，异常信息:{}",throwable.toString()
                        ,throwable);
                return null;
            }
        };
    }
}
